/**
  ******************************************************************************
  * @file    WF_Disconnect.c
  * @author  exatron
  * @version V1.0.0
  * @date    segunda, 22 de dezembro de 2014
  * @brief   Função para desconectar da rede.
  ******************************************************************************
  * @attention
  *
  *
  ******************************************************************************
  */

/** @addtogroup WF
  * @{
  */

/* Includes ------------------------------------------------------------------*/
#include <common.h>
#include <stdlib.h>

/* External functions --------------------------------------------------------*/

/** @defgroup WF_Functions
  * @{
  */

/**
  * @brief  Função para desconectar da rede.
  * @param  Nenhum
  * @retval Devolve pela serial Result_t
  */
void WF_Disconnect(void)
{
	if(aux_GetConnectionState() == Status_ConnectionConnected)
	{
		//system("/etc/init.d/network stop > /dev/null 2> /dev/null");
		system("wifi down > /dev/null 2> /dev/null");
		aux_SetConnectionState(Status_ConnectionDisconnected);
		aux_USART0_puts("%s=%d\r\n", "WF_DCN", Result_Ok);
	}
	else
	{
		aux_USART0_puts("%s=%d\r\n", "WF_DCN", Result_Error);
	}

	aux_SetBusy(FALSE);
}

/**
  * @}
  */

/**
  * @}
  */



